/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.posplus.losspreventiondataimporter.service;

import com.posplus.lossprevention.APDAOFactory;
import com.posplus.lossprevention.dao.RegistersDAO;
import com.posplus.lossprevention.mapping.Registers;
import java.util.Iterator;
import java.util.List;

/**
 *
 * @author scottw
 */
public class RegistersService {
    private RegistersDAO registerDAO;
    
    public RegistersService(APDAOFactory lpFactory){
        this.registerDAO = lpFactory.getRegistersDAO();
    }
    
    public void bulkInsert(List<Registers> registers){
        registerDAO.bulkInsert(registers);
    }

    public void save(Registers register) {
        registerDAO.makePersistent(register);
    }

    public void saveAll(List<Registers> mappedRegisters) {
	Iterator<Registers> iter = mappedRegisters.iterator();
	while (iter.hasNext()) {
	    registerDAO.save(iter.next());
	    
	}
    }
}
